//
//  main.cpp
//  this指针
//
//  Created by linjinzhu on 2017/7/11.
//  Copyright © 2017年 baidu. All rights reserved.
//

#include <iostream>

using namespace std;

class Box {
private:
    int x,y,z;

public:
    int volume();
    int compare(Box b);
    Box(int _x, int _y, int _z);
    ~Box();
};

int Box::volume()
{
    return x * y * z;
}

int Box::compare(Box b) {
    return this->volume() > b.volume();
}

Box::Box(int _x, int _y, int _z) {
    x = _x;
    y = _y;
    z = _z;
}

Box::~Box() {
    cout << "free memory" << endl;
}

int main(int argc, const char * argv[]) {

    Box b1(3,3,3);
    Box b2(2,2,2);
    Box b3(2,5,5);

    if (b1.compare(b2)) {
        cout << "b1 大于 b2" << endl;
    } else {
        cout << "b1 小于 b2" << endl;
    }

    cout << b1.compare(b2) << endl;
    cout << b2.compare(b3) << endl;
    cout << b3.compare(b3) << endl;


    return 0;
}
